import 'package:ayj_flutter_chat_app/database/friend_list/friend_info_db.dart';
import 'package:floor/floor.dart';

@dao
abstract class FriendListDao {
  @Query('SELECT * FROM FriendList')
  Future<List<FriendInfoDb>> findAllContacts();

  @Query('SELECT * FROM FriendList WHERE userID = :id')
  Future<FriendInfoDb?> findContactById(String id);

  @Query('DELETE FROM FriendList') // 清空表
  Future<void> deleteAllFriendList();

  @insert
  Future<void> insertFriend(FriendInfoDb friend);

  @insert
  Future<void> insertFriendList(List<FriendInfoDb> friends);

  @update
  Future<void> updateFriend(FriendInfoDb friend);

  @delete
  Future<void> deleteFriend(FriendInfoDb friend);
}
